package org.elephas.webapp.backend.component.management;

import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.elephas.webapp.backend.component.EditablePropertyColumn;
import org.elephas.webapp.model.DetachableBlogModel;

public class UserManagementPanel extends Panel {
	private static final long serialVersionUID = 1L;

	public UserManagementPanel(String id, DetachableBlogModel blogModel) {
		super(id);
		List<IColumn> columns = new ArrayList<IColumn>();
		columns.add(new EditablePropertyColumn(new Model("First Name"),
				"user.firstName"));
		columns.add(new EditablePropertyColumn(new Model("Last Name"),
				"user.lastName"));
		columns.add(new EditablePropertyColumn(new Model("Email"),
				"user.emailAddress"));
		columns.add(new EditablePropertyColumn(new Model("Role"),
				"blogRole"));

		add(new AjaxFallbackDefaultDataTable("table", columns,
				new SortableBlogMembershipDataProvider(blogModel), 10));
	}

}
